<%@ include file="/WEB-INF/jsp/include/head.jsp" %><%@ page language="java" pageEncoding="UTF-8"%>
<html>
<head>
	<%@ include file="/WEB-INF/jsp/include/title.jsp" %>
	<%@ include file="/WEB-INF/jsp/include/common_css.jsp" %>
	<%@ include file="/WEB-INF/jsp/include/common_script.jsp" %>
	<script type="text/javascript">
	//<![CDATA[
	<%@ include file="/js/question/question.js" %>
	//]]>
	</script>
</head>
<body>
<%@ include file="/WEB-INF/jsp/include/top.jsp" %>
	<div><spring:message code="label.question.add"/></div>
	<div id="treeView">
		<label><spring:message code="question.classification"/></label>
		<div id="classificationTree"></div>
	</div>
	<div id="subContentsView">
		<form:form id="frmQuestion" method="post" action="add.html" commandName="question">
			<form:hidden path="classification" id="classification" />
			<form:hidden path="sid" id="sid" />
			<ul>
				<li>
					<label><spring:message code="question.patternCode"/></label>
					<form:select path="patternCode" onchange="questionType();">
						<form:options items="${patternCode}" />
					</form:select>
					<form:errors path="patternCode" />
				</li>
				<li>
					<label><spring:message code="question.question"/></label> 
					<form:input path="question" />
					<form:errors path="question" />
				</li>
				<li id="answer">
					<label><spring:message code="question.answer"/></label>
					<form:input path="answer.answer" />
					<form:errors path="answer.answer" />
				</li>
				<li id="item">
					<ul>
						<li>
							<input type="button" name="addItem" value="<spring:message code="button.add"/>" class="button" onclick="javascript:addItems('5');"/>
						</li>
						<c:forEach items="${question.itemList}" var="item" end="4" varStatus="status">
						<c:if test="${not empty item.content}">
						<li id="item${status.count}">
							<label>-</label>
							<form:input path="itemList[${status.index}].content" />
							<a href="javascript:removeItem(${status.count});">X</a>
							<form:checkbox id="itemList${status.index}.answerYn" path="itemList[${status.index}].answerYn" value="1" />
							<spring:message code="question.answer"/>
						</li>
						</c:if>
						</c:forEach>
					</ul>
				</li>
				<li>
					<label><spring:message code="question.example"/></label> 
					<form:textarea path="example" />
					<form:errors path="example" />
				</li>				
				<li>
					<label><spring:message code="question.grade"/></label> 
					<form:select path="grade" items="${grade}" />
				</li>
				<li>
					<label><spring:message code="question.hearingYn"/></label>
					<form:checkbox path="hearingYn" value="1" /> <spring:message code="question.hearingYn" />
				</li>
				<li>
					<label><spring:message code="question.state"/></label>
					<form:select path="state" items="${state}" />
				</li>
				<li>
					<label><spring:message code="question.shareYn"/></label>
					<form:radiobutton path="shareYn" value="0" /> <spring:message code="question.shareN" />
					<form:radiobutton path="shareYn" value="1" /> <spring:message code="question.shareY" />
				</li>
				<li>
					<label><spring:message code="question.commentary"/></label>
					<form:textarea path="commentary.description" />
				</li>
				<li>
					<input type="submit" name="modifyQuestion" value="<spring:message code="button.modify"/>" class="button" />
					<input type="reset" name="resetQuestion" value="<spring:message code="button.reset"/>" class="button" />
				</li>
			</ul>
		</form:form>
	</div>
	<div id="subMenuView"><a href="<c:url value="/question/list.html"/>"><spring:message code="button.list"/></a></div>
<%@ include file="/WEB-INF/jsp/include/footer.jsp" %>	
</body>	
</html>